package Lesson4;

import java.util.Scanner;

public class Class5TaskSeven {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		
		System.out.println("Enter the array length: ");
		
		int n = sc.nextInt();
		int[][] arr = new int [n][n];
		
		int number;
		
		for (int i = 0; i < arr.length; i++)
		{
			for (int j = 0; j < arr[i].length; j++)
			{
				arr[i][j] = (int)(Math.random()*10);	
			}
		}
		
		for (int i = 0; i < arr.length; i++)
		{
			for (int j = 0; j < arr[i].length; j++)
			{
				System.out.print(arr[i][j] + " ");
			}
			System.out.println();
		}
		System.out.println();
		for (int i = 0; i < arr.length-1; i++)
		{
			for (int j = 0; j < arr[i].length; j++)
			{
				if(i==j)
				{
					System.out.print(arr[i+1][j] + " ");
					
				}
				
			}
		}
		
		
		
		
		
		
	}

}
